package com.offcn.question.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Configuration
@EnableTransactionManagement        //事务管理器
public class MyBatisPageConfig {

    //引入分页插件
    @Bean
    public PaginationInterceptor paginationInterceptor(){
        PaginationInterceptor interceptor = new PaginationInterceptor();
        //设置请求的页面大于最大操作页后,  true代表回到首页  false代表继续请求
        interceptor.setOverflow(true);
        //设置最大单页限制数量        默认500条  -1表示不受限制
        interceptor.setLimit(10);
        return interceptor;

    }
}
